<?php
require_once 'lib/controllerWithoutGetOrPost.php';

/**
 * Set the blurb for the featured person
 *
 * @return bool
 * @param int $personId
 * @param string $blurb
 */
function setFeaturingPersonBlurb($personId, $blurb) {
	global $db;
    $queryfeaturingperson = "Select `PersonID` from FeaturingPerson where PersonID = ".$personId;
	
	$resultfeaturingperson = $db->query($queryfeaturingperson);
	
	if(!empty($resultfeaturingperson)) {
        $queryupdate = "Update FeaturingPerson Set `Blurb` = '".$blurb."' WHERE `PersonID` = ".$personId;
		$resultupdate = $db->query($queryupdate);
	}
    return $resultupdate === TRUE;
}

$username = $db->escape($_POST['username']);
$password = $db->escape($_POST['password']);
if($username === "amemorytree" && $password === "pass153word") {
    $personId = intval($_POST['personid']);
    $blurb = $db->escape($_POST['blurb']);
    setFeaturingPersonBlurb($personId, $blurb);
} 
?>